package com.qcby.dao;

import com.qcby.entity.*;
import com.qcby.entity.Query.ShopQuery;
import com.qcby.entity.Review;
import com.qcby.entity.Shop;
import com.qcby.entity.ShopSTag;
import com.qcby.entity.Tag;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ShopDao {
    List<ShopSTag> findTag();

    List<Shop> list(ShopQuery shopQuery);

    void deleteById(Integer id);

    void deleteTagId(Integer id);

    Shop findById(Integer id);
    List<ShopQuery> findAll(Shop shop);
    List<Tag> findTags();
    Shop goToDetail(Integer id);
    List<Shop> selectShopByTag(String tagName);

    //List<Review> getReviewsByShopId(Integer id);
    int like(@Param("targetId") Integer targetId, @Param("userId") Integer userId);
    Integer likeStatus(@Param("targetId") Integer targetId, @Param("userId") Integer userId);

    int likeCount(@Param("targetId") Integer targetId, @Param("target_type")String target_type);

    int likeDelete(@Param("targetId") Integer targetId,
                   @Param("userId") Integer userId,
                   @Param("target_type")String target_type);

    int rating(        @Param("shopId") Integer shopId,
                       @Param("userId") Integer userId,
                       @Param("rating") Integer rating);

    Integer ratingCount(    @Param("shopId") Integer shopId,@Param("userId") Integer userId);

    List<User> findUserList();

    void add(Shop shop);

    void updateById(Shop shop);

    double getRecent100RatingsAverage(Integer shopId);

    Integer updateShopRatingStatus();

    Integer addReview(Review review);
    
    List<Shop> findAll1();

    List<Review> getReplies(Integer reviewId);

    Integer likeReview(@Param("targetId") Integer targetId,
                       @Param("userId") Integer userId);

    Integer syncReviewLikeCount();

    Integer cancelReviewLike(@Param("targetId") Integer targetId,
                             @Param("userId") Integer userId,
                             @Param("target_type")String target_type);

    List<Shop> findByPage(@Param("query") ShopQuery query,  // 命名为 "query"，与 XML 中的 query 匹配
                          @Param("start") int start,        // 命名为 "start"，与 XML 中的 start 匹配
                          @Param("pageSize") int pageSize );

    int countByQuery(@Param("query") ShopQuery query);
    int countReviewsByShopId(@Param("shopId") Integer shopId);

    List<Review> getReviewsByShopId(
            @Param("shopId") Integer shopId,
            @Param("start") int start,  // 注意：参数名改为 start（与 XML 中的 #{start} 对应）
            @Param("pageSize") int pageSize
    );

    List<Shop> getShopsByUserId(Integer userId);

    List<Shop> getShopsByUserName(String userName);

    Shop getShopsByAduit(Integer id);

    void addShop(Shop shop);

}
